//================================================
var loadType = ''; // 团队组建或展业培训
var loadTag=''; // 类型 :基础，专业，实操

/**
 * 初始化滚动
 */
mui('#pullrefresh1').scroll({
    deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
});

/**
 * 重置
 */
function loadReset(){
    mui('.mui-scroll-wrapper').scroll().scrollTo(0,0,100);//100毫秒滚动到顶
    setTimeout(()=>{
        var $table = document.body.querySelector('#pullrefresh1 .mui-table-view');
        $table.innerHTML = '';
        loadData()
    },500)
}

/**
 *  加载通讯录
 *  loadType; // 团队组建或展业培训
 *  loadTag; // 基础，专业，实操
 */
function  loadData() {
    var $table = document.body.querySelector('#pullrefresh1 .mui-table-view');
    setTimeout(()=>{
        for(var i=0;i<10;i++){
            var li = document.createElement('li');
            li.className = 'mui-table-view-cell mui-media mui-col-xs-6';
            li.innerHTML = ` <a href="study_detail.html">
                    <img class="mui-media-object" src="../../images/banner/shuijiao.jpg">
                    <div class="mui-media-body">新服务商指导</div>
                </a>`;
            $table.appendChild(li)
            bindTap(li);
        }
    },500);
}

/**
 * 事件绑定
 */
function bindTap(ele){
    // 查看服务商业绩
    mui(".mui-table-view ").on('tap','.mui-table-view-cell',function () {
        console.log("className",this.className)

        location.href = "study_detail.html?id=1212"
    });

}
mui.ready(function () {
    var obj = getpara();
    loadType =  obj.flag; // 团队组建或展业培训

    // 加载
    loadData();

    // 通讯录切换
    mui("#segmentedControl").on("tap","a",function () {
        var tagIndex = this.getAttribute('tag'); // day || month
        console.log('tabs',tagIndex)
        loadTag = tagIndex;
        // 重置
        loadReset();
    })
});


